package com.jsgt.greekfire.common.util

import android.os.Looper
import com.fhx.core.utils.ActivityStackManager
import com.fhx.core.utils.ToastUtils

object UncaughtExceptionHandlerUtil {
    fun process() {
        Thread.setDefaultUncaughtExceptionHandler { t, e ->
            e.printStackTrace()
            ActivityStackManager.finishAll()
            Thread{
                Looper.prepare()
                ToastUtils.show("程序异常，正在退出")
                Looper.loop()
            }.start()
            Thread.sleep(2000)
            System.exit(1)
        }
    }
}